#!/bin/bash
oracleEnvFile="11g.tar.gz"
echo "setup1: ******* Determine whether oracle env file exists ******"
if [ ! -f "$oracleEnvFile" ]; then
  echo "文件不存在：$file"
  exit 1
fi
echo "setup2: ******* Unzip the oracle env file ******"
tar xf $oracleEnvFile
echo "setup3: ******* Determine whether oracle env file path exists ******"
export g11Path="instantclient_11_2"
current_dir=$(pwd)
combined_dir="${current_dir}/${g11Path}"
if [ ! -d "$combined_dir" ]; then
  echo "目录不存在：$combined_dir"
  exit 1
fi
echo "setup4: ****** export oracle env environment variables ******"
echo "export LD_LIBRARY_PATH=$combined_dir:$LD_LIBRARY_PATH" >>~/.bashrc
#cat ~/.bashrc|grep LD_LIBRARY_PATH|grep "${combined_dir}"
bash -c "source ~/.bashrc"